import request from '@/utils/request'

// 获取自定义页列表
export function pageCustomPage(query) {
  return request({
    url: '/component/page/paging',
    method: 'get',
    params: query
  })
}
// 获取自定义页列表
export function listCustomPage(query) {
  return request({
    url: '/component/page/list',
    method: 'get',
    params: query
  })
}

// 统计自定义页情况
export function statPage(query) {
  return request({
    url: '/component/page/statPage',
    method: 'get',
    params: query
  })
}

// 获取自定义页
export function getPage(pageId, appType) {
  return request({
    url: '/component/page/get',
    method: 'get',
    params: { pageId: pageId, appType: appType }
  })
}

// 只保存自定义页面，不保存组件列表
export function saveCustomPageOnly(data) {
  return request({
    url: '/component/page/saveCustomPageOnly',
    method: 'post',
    data: data
  })
}

// 保存自定义页
export function saveCustomPage(data) {
  return request({
    url: '/component/page/save',
    method: 'post',
    data: data
  })
}
// 发布首页
export function publishCustomPage(enterpriseId, pageId, appType, homeType) {
  return request({
    url: '/component/page/publish',
    method: 'post',
    params: { enterpriseId, pageId, appType, homeType }
  })
}

// 删除自定义页
export function deleteCustomPage(pageId) {
  return request({
    url: '/component/page/delete',
    method: 'post',
    params: { pageId }
  })
}

// 获取企业最新的促销活动-对应的商品列表（秒杀组-自动选择活动）
export function listAutoPromotionGoods(params) {
  return request({
    url: '/component/page/listAutoPromotionGoods',
    method: 'post',
    params
  })
}

// 手动获取企业促销活动-对应的商品列表（秒杀组-手动选择活动）
export function listManualPromotionGoods(params) {
  return request({
    url: '/component/page/listManualPromotionGoods',
    method: 'post',
    params
  })
}

// 直播列表分页
export function pageLive(params) {
  return request({
    url: '/component/page/pageLive',
    method: 'get',
    params
  })
}

// 获取商品分页
export function getGoodsPage(data) {
  return request({
    url: '/component/page/getGoodsPage',
    method: 'post',
    data
  })
}

// 复制云店小程序首页
export function copyCustomPage(pageId, pageTitle, appType) {
  return request({
    url: '/component/page/copyCustomPage',
    method: 'post',
    params: { pageId, pageTitle, appType }
  })
}

export function saveSearchPageHotWord(data) {
  return request({
    url: '/component/page/saveSearchPageHotWord',
    method: 'post',
    data: data
  })
}

// 获取企业配置的热词
export function getHotWordList(query) {
  return request({
    url: '/component/page/getHotWordList',
    method: 'get',
    params: query
  })
}
